<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机点名系统</title>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="styles.css">
</head>

<body class="bg-gradient-to-br from-blue-50 to-indigo-50 min-h-screen font-inter text-dark">
    <!-- 顶部导航栏 -->
    <nav class="bg-white/80 backdrop-blur-md shadow-sm fixed w-full top-0 z-50 transition-all duration-300">
        <div class="container mx-auto px-4 py-3 flex justify-between items-center">
            <div class="flex items-center space-x-2">
                <i class="fa fa-random text-primary text-2xl"></i>
                <h1 class="text-xl md:text-2xl font-bold text-primary">随机点名系统</h1>
            </div>
            <div class="flex items-center space-x-4">
                <button id="theme-toggle" class="p-2 rounded-full hover:bg-gray-100 transition-colors">
                    <i class="fa fa-moon-o text-gray-600"></i>
                </button>
                <button
                    class="hidden md:flex items-center space-x-1 bg-primary/10 text-primary px-4 py-2 rounded-full hover:bg-primary/20 transition-colors">
                    <i class="fa fa-question-circle"></i>
                    <span>帮助</span>
                </button>
            </div>
        </div>
    </nav>

    <!-- 主内容区 -->
    <main class="container mx-auto px-4 pt-24 pb-16">
        <!-- 欢迎区域 -->
        <section class="text-center mb-12 animate-fade-in">
            <h2 class="text-[clamp(1.8rem,4vw,2.8rem)] font-bold text-dark mb-4 text-shadow">
                随机点名，公平公正
            </h2>
            <p class="text-gray-600 max-w-2xl mx-auto text-[clamp(1rem,2vw,1.2rem)]">
                上传您的Excel文件，选择姓名列，开始随机点名。简单易用，高效便捷。
            </p>
        </section>

        <!-- 文件上传区域 -->
        <section id="upload-section" class="max-w-3xl mx-auto mb-16">
            <div class="bg-white rounded-2xl shadow-lg p-6 md:p-8 card-hover">
                <div class="text-center mb-8">
                    <div class="w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-4">
                        <i class="fa fa-file-excel-o text-primary text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-semibold mb-2">上传Excel文件</h3>
                    <p class="text-gray-500">支持.xlsx和.xls格式，确保文件包含姓名列</p>
                </div>

                <div class="border-2 border-dashed border-gray-300 rounded-xl p-8 text-center hover:border-primary transition-colors cursor-pointer"
                    id="drop-area">
                    <input type="file" id="file-input" accept=".xlsx,.xls" class="hidden">
                    <button type="button" id="file-select-btn"
                        class="bg-primary hover:bg-primary/90 text-white font-medium py-3 px-6 rounded-lg transition-all shadow-md hover:shadow-lg transform hover:-translate-y-0.5">
                        <i class="fa fa-upload mr-2"></i>选择文件
                    </button>
                    <p class="mt-4 text-gray-500">或者拖放文件到此处</p>
                    <div class="mt-4 text-sm text-gray-400">
                        <i class="fa fa-info-circle mr-1"></i>最大文件大小: 10MB
                    </div>
                </div>

                <div id="file-info" class="mt-6 hidden">
                    <div class="bg-gray-50 rounded-lg p-4 flex items-center justify-between">
                        <div class="flex items-center">
                            <i class="fa fa-file-excel-o text-primary mr-3"></i>
                            <div>
                                <p id="file-name" class="font-medium"></p>
                                <p id="file-size" class="text-sm text-gray-500"></p>
                            </div>
                        </div>
                        <button id="remove-file" class="text-gray-400 hover:text-red-500">
                            <i class="fa fa-times-circle"></i>
                        </button>
                    </div>
                </div>
            </div>
        </section>

        <!-- 列选择区域 -->
        <section id="column-selection" class="max-w-3xl mx-auto mb-16 hidden">
            <div class="bg-white rounded-2xl shadow-lg p-6 md:p-8">
                <h3 class="text-xl font-semibold mb-6 flex items-center">
                    <i class="fa fa-list-ul text-primary mr-2"></i>选择姓名列
                </h3>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                    <div class="col-span-1">
                        <label for="name-column" class="block text-sm font-medium text-gray-700 mb-2">姓名列</label>
                        <div class="relative">
                            <select id="name-column"
                                class="block w-full pl-3 pr-10 py-3 text-base border-gray-300 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm rounded-lg appearance-none bg-white">
                                <!-- 选项将通过JavaScript动态添加 -->
                            </select>
                            <div
                                class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
                                <i class="fa fa-chevron-down text-xs"></i>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="flex justify-end">
                    <button id="start-naming"
                        class="bg-secondary hover:bg-secondary/90 text-white font-medium py-3 px-8 rounded-lg transition-all shadow-md hover:shadow-lg transform hover:-translate-y-0.5 flex items-center">
                        <i class="fa fa-random mr-2"></i>开始随机点名
                    </button>
                </div>
            </div>
        </section>

        <!-- 点名结果区域 -->
        <section id="result-section" class="max-w-3xl mx-auto mb-16 hidden">
            <div class="bg-white rounded-2xl shadow-lg p-6 md:p-8">
                <h3 class="text-xl font-semibold mb-6 flex items-center">
                    <i class="fa fa-user-circle-o text-primary mr-2"></i>点名结果
                </h3>

                <div class="flex justify-center mb-8">
                    <div id="name-display"
                        class="text-[clamp(2rem,6vw,3.5rem)] font-bold text-center py-8 px-4 rounded-xl bg-primary/5 min-h-[120px] flex items-center justify-center w-full max-w-md transition-all">
                        <span class="animate-pulse-slow">准备开始...</span>
                    </div>
                </div>

                <div class="flex flex-wrap justify-center gap-4">
                    <button id="roll-again"
                        class="bg-primary hover:bg-primary/90 text-white font-medium py-3 px-8 rounded-lg transition-all shadow-md hover:shadow-lg transform hover:-translate-y-0.5 flex items-center">
                        <i class="fa fa-refresh mr-2"></i>再抽一次
                    </button>
                    <button id="export-result"
                        class="bg-green-600 hover:bg-green-700 text-white font-medium py-3 px-8 rounded-lg transition-all shadow-md hover:shadow-lg transform hover:-translate-y-0.5 flex items-center">
                        <i class="fa fa-download mr-2"></i>导出结果
                    </button>
                    <button id="back-to-upload"
                        class="bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-3 px-8 rounded-lg transition-all shadow-md hover:shadow-lg transform hover:-translate-y-0.5 flex items-center">
                        <i class="fa fa-arrow-left mr-2"></i>返回
                    </button>
                </div>
            </div>
        </section>

        <!-- 历史记录区域 -->
        <section id="history-section" class="max-w-3xl mx-auto">
            <div class="bg-white rounded-2xl shadow-lg p-6 md:p-8">
                <h3 class="text-xl font-semibold mb-6 flex items-center">
                    <i class="fa fa-history text-primary mr-2"></i>点名历史
                </h3>

                <div id="history-list" class="space-y-3 max-h-60 overflow-y-auto pr-2">
                    <div class="text-center text-gray-400 py-8">
                        <i class="fa fa-clock-o text-3xl mb-2"></i>
                        <p>暂无点名历史</p>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="bg-white/80 backdrop-blur-md py-6 border-t border-gray-200">
        <div class="container mx-auto px-4 text-center text-gray-500 text-sm">
            <p>© 2025 随机点名系统 | 设计与开发</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
    <script src="script.js"></script>
</body>

</html>